<template>
  <!-- 确认发货页 -->
  <div class="ConfirmDelivery">
    <van-nav-bar left-arrow @click-left="$router.go(-1)"> </van-nav-bar>
    <van-cell-group>
      <van-cell title="客户" :value="cusName" />
      <van-cell title="商品" :value="prodName" />
      <van-cell title="数量" :value="prodNum" />
      <van-cell title="下单人" :value="orderUserName" />
      <van-cell title="下单时间" :value="orderTime" />
    </van-cell-group>
    <van-field v-model="custName" label="收货人" placeholder="请输入姓名"/>
    <!-- 输入手机号，调起手机号键盘 -->
    <van-field v-model="tel" type="tel" label="手机号" placeholder="请输入手机号"/>
    <!-- 允许输入正整数，调起纯数字键盘 -->
    <van-field
      v-model="message"
      rows="1"
      autosize
      label="收货地址"
      type="textarea"
      placeholder="请输入收货地址"
    />
    <!--  物流单号 -->
    <van-field v-model="digit" type="digit" label="物流单号" placeholder="请输入物流单号"/>
    <div class="btn">
      <van-button round type="info" @click="DeliverGoodsClick">确认发货信息</van-button>
    </div>
  </div>
</template>

<script>
import {DeliverGoods} from "@/request/api"
export default {
  data() {
    return {
      // 单元格内容
      cusName: "",
      prodName: "",
      orderUserName: "",
      orderTime: "",

      custName: "",
      tel: "13888888888",
      message: "广东省 广州市 天河区 棠下街道 大地工业区D栋",
      digit: "",
    };
  },
  methods: {
    DeliverGoodsClick(){
      DeliverGoods({
        serialNo:JSON.parse(this.$route.query.info).serialNo,
        receiver:this.custName,
        linkPhone:this.tel,
        address:this.message,
        logisticsCode:this.digit
      }).then(res=>{
        console.log(res);
        if(res.errCode == 0){
          this.$router.go(-1)
        }
      })
    }
  },
  created() {
    console.log(JSON.parse(this.$route.query.info));
    let info = JSON.parse(this.$route.query.info);
    this.cusName = info.cusName;
    this.prodName = info.prodName;
    this.prodNum = info.prodNum;
    this.orderUserName = info.orderUserName;
    this.orderTime = info.orderTime
    

    // this.tel = info.linkPhone
    this.custName = info.orderUserName
    // this.message = info.address
    this.digit = info.serialNo
  },
};
</script>
 
<style lang = "less" scoped>
.ConfirmDelivery {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  overflow: scroll;
  background-color: pink;
  z-index: 99;
}
/deep/.van-nav-bar__content {
  background-color: blue;
  .van-icon-arrow-left {
    color: #fff;
  }
}
.van-cell-group {
  margin: 10px 0;
}
.btn {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  .van-button {
    width: 100%;
  }
}
</style>